package com.keon.jianbao.ui.widget;

import android.content.Context;
import android.support.v4.view.ActionProvider;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;

import com.keon.jianbao.R;

/**
 * Created by keon on 15/10/27.
 */
public class ShareActionProvider extends ActionProvider {

    private Context context;

    public ShareActionProvider(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public View onCreateActionView() {
        return null;
    }

    @Override
    public void onPrepareSubMenu(SubMenu subMenu) {

        subMenu.clear();
        subMenu.add("").setIcon(R.mipmap.wechat).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
//                .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
//                    @Override
//                    public boolean onMenuItemClick(MenuItem item) {
//                        return true;
//                    }
//                });
        subMenu.add("").setIcon(R.mipmap.ic_launcher)
                .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        return false;
                    }
                });

    }

    @Override
    public boolean hasSubMenu() {
        return true;
    }
}